﻿using System;
using System.Collections.Generic;
using System.Windows.Controls;
using System.Linq;
using System.Windows;

namespace QuanLyDuocPham.Controllers.QuanLyHeThong.DanhMuc
{
    class NHOMBENH_Control : IDisposable
    {
        DuocPhamDataContext db = new DuocPhamDataContext(staticClass.Conn);
        public void Dispose()
        {
            if (db != null)
            {
                db.Dispose();
                db = null;
            }
        }
        public void loadComboBox(ComboBox cmb)
        {

            cmb.Items.Clear();
            var list = db.NHOMBENH_Get_List();
            var typeorder = list.OrderBy(w => w.TEN_NHOMBENH);

            foreach (var t in typeorder)
            {
                cmb.Items.Add(t);
            }
            
            cmb.SelectedValuePath = "MA_NHOMBENH";
            cmb.IsTextSearchEnabled = true;
            cmb.IsTextSearchCaseSensitive = false;
            cmb.IsEditable = true;

        }
    }
}
